package com.toxictest.testproject.core;

import static playn.core.PlayN.graphics;
import playn.core.Canvas;
import playn.core.CanvasImage;
import playn.core.Color;
import playn.core.ImageLayer;

public class Quad {
	
	private ImageLayer image;
	private static int SIDE=25;
	private int color=  Color.rgb(0, 0 , 150);
	
	public Quad() {
		CanvasImage canvasImg = graphics().createImage(getSIDE(), getSIDE());
		Canvas canvas = canvasImg.canvas();
		canvas.setFillColor(color);
		canvas.fillRect(0, 0, getSIDE(), getSIDE());
		setImage(graphics().createImageLayer(canvasImg));
	}
	
	public Quad(int myColor){
		CanvasImage canvasImg = graphics().createImage(getSIDE(), getSIDE());
		Canvas canvas = canvasImg.canvas();
		canvas.setFillColor(myColor);
		canvas.fillRect(0, 0, getSIDE(), getSIDE());
		setImage(graphics().createImageLayer(canvasImg));
	}
	
	public Quad(int myColor,int side){
		SIDE=side;
		CanvasImage canvasImg = graphics().createImage(getSIDE(), getSIDE());
		Canvas canvas = canvasImg.canvas();
		canvas.setFillColor(myColor);
		canvas.fillRect(0, 0, getSIDE(), getSIDE());
		setImage(graphics().createImageLayer(canvasImg));
	}
	
	public ImageLayer getImage() {
		return image;
	}

	public void setImage(ImageLayer image) {
		this.image = image;
	}

	public static int getSIDE() {
		return SIDE;
	}
	
}
